package com.sunzhe.member.web;

import org.springframework.stereotype.Controller;

/**
 * 培训会员 接口
 */
@Controller
public class MemberController{

//    private final Log log = LogFactory.getLog(this.getClass());
//    private static final String MODEL = "member";
//
//    @Autowired
//	MemberService memberService;
//    @Autowired
//	PlatformService platformService;
//
//    @RequestMapping(MODEL + "/login.do")
//	public ModelAndView login() {
//		ModelAndView view = new ModelAndView(MODEL + "/index.html");
//		return view;
//	}
//
//    @PostMapping(MODEL + "/login.json")
//	@ResponseBody
//	public JsonResult<MemberLoginInfo> login(String phone, String password) {
//		MemberLoginInfo info = memberService.login(phone, password);
//		if (info == null) {
//			return JsonResult.failMessage("用户名或密码错误");
//		}
//		Member member = info.getMember();
//		// 记录登录信息到session
//		this.platformService.setLoginMember(info.getMember());
//		return JsonResult.success(info);
//	}
//
//    @RequestMapping(MODEL + "/logout.do")
//	public ModelAndView logout(HttpServletRequest request) {
//		HttpSession session = request.getSession();
//		Enumeration eum = session.getAttributeNames();
//		this.platformService.removeLoginMember();
//		ModelAndView view = new ModelAndView("redirect:/");
//		return view;
//	}
//
//    @RequestMapping(MODEL + "/logout.json")
//    @ResponseBody
//	public JsonResult logoutJson(HttpServletRequest request) {
//		this.logout(request);
//		return JsonResult.success();
//	}
//
//    /**
//     * 注册会员
//     * @param member
//     * @return
//     */
//    @PostMapping(MODEL + "/reg.json")
//	@ResponseBody
//	public JsonResult<Integer> reg(@Validated(ValidateConfig.ADD.class)Member member, HttpServletRequest request) {
//    	String verifyCode = request.getParameter("verifyCode");
//    	String verCode = (String)request.getSession().getAttribute("verCode");
//    	verifyCode = "";verCode = "";
//    	if (StringUtils.equals(verifyCode, verCode) == false) {
//    		return JsonResult.failMessage("验证码不正确");
//    	}
//
//    	String password = request.getParameter("password");
//    	String repassword = request.getParameter("repassword");
//    	if (StringUtils.equals(password, repassword) == false) {
//    		return JsonResult.failMessage("两次输入密码不正确");
//    	}
//
//		member.setCreateTime(new Date());
//		memberService.addMember(member);
//
//		return JsonResult.success(member.getId());
//	}
}
